package com.itcat.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itcat.api.mysql.SmsHomeAdvertiseApi;
import com.itcat.mysql.pojo.SmsHomeAdvertise;
import com.itcat.service.SmsHomeAdvertiseService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SmsHomeAdvertiseServiceImpl implements SmsHomeAdvertiseService {

    @DubboReference
    private SmsHomeAdvertiseApi smsHomeAdvertiseApi;


    //分页查询广告
    @Override
    public Page<SmsHomeAdvertise> findList(String endTime,Integer pageNum, Integer pageSize, String name, Integer type) {
        Page<SmsHomeAdvertise> page = smsHomeAdvertiseApi.findList(endTime,pageNum,pageSize,name,type);
        return page;
    }

    //查询广告详情
    @Override
    public SmsHomeAdvertise queryOne(Integer id) {
        return smsHomeAdvertiseApi.queryOne(id);
    }

    //添加广告
    @Override
    public void create(SmsHomeAdvertise smsAdvertise) {
        smsHomeAdvertiseApi.create(smsAdvertise);
    }

    //删除广告
    @Override
    public void delete(List<Integer> ids) {
        smsHomeAdvertiseApi.delete(ids);
    }

    @Override
    public void deleteById(Integer id) {
        smsHomeAdvertiseApi.deleteById(id);
    }

    //根据ID修改状态
    @Override
    public void updateStatus(Integer id, Integer status) {
        smsHomeAdvertiseApi.updateStatus(id,status);
    }

    //根据ID修改广告
    @Override
    public void updateById(Integer id, SmsHomeAdvertise smsHomeAdvertise) {
        smsHomeAdvertiseApi.updateById(id,smsHomeAdvertise);
    }
}
